package com.dream.keigezhushou.Activity.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;

import com.dream.keigezhushou.Activity.acty.listen.HotRecommendActivity;
import com.dream.keigezhushou.Activity.acty.personal.MyRingActivity;
import com.dream.keigezhushou.R;

import java.util.ArrayList;

/**
 *   我的铃声adapter
 */
public class MyRingAdapter extends RecyclerView.Adapter<MyRingAdapter.MyViewHolder> {

    private Context context;

    private MyRingActivity.MyItemClickListener myItemClickListener;

    public MyRingAdapter(Context context) {

        this.context = context;

    }

    public void setOnItemClickListener(MyRingActivity.MyItemClickListener myItemClickListener) {
        this.myItemClickListener = myItemClickListener;
    }


    @Override
    public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {

        View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.layout_ring_iten, null);
        return new MyViewHolder(view);

    }

    @Override
    public void onBindViewHolder(MyViewHolder holder, final int position) {

        holder.ivMore.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                if (myItemClickListener != null) {
                    myItemClickListener.onBtnClick(position);
                }
            }
        });

    }


    int c = 20;

    @Override
    public int getItemCount() {
        return c;
    }


    public class MyViewHolder extends RecyclerView.ViewHolder {
        TextView tvMusic, tvSinger;
        ImageView ivMore;

        public MyViewHolder(View itemView) {

            super(itemView);

            tvMusic = (TextView) itemView.findViewById(R.id.tv_song_name);
            tvSinger = (TextView) itemView.findViewById(R.id.tv_singer);
            ivMore = (ImageView) itemView.findViewById(R.id.iv_dialog);
        }
    }
}
